Stirling numbers of the second kind

In mathematics, particularly in combinatorics, a Stirling number of the second kind is the number of ways to partition a set of n objects into k non-empty subsets and is denoted by S(n,k) or \textstyle \lbrace{n\atop k}\rbrace.[1] Stirling numbers of the second kind occur in the field of mathematics called combinatorics and the study of partitions.

Stirling numbers of the second kind is one of two kinds of Stirling numbers, the other kind being called Stirling numbers of the first kind. Mutually inverse (finite or infinite) triangular matrices can be formed by arranging the Stirling numbers of the first respectively second kind according to the parameters n, k.

Contents

Definition

The Stirling numbers of the second kind \lbrace\textstyle{n\atop k}\rbrace count the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. Equivalently, they count the number of different equivalence relations with precisely k equivalence classes that can be defined on an n element set. They can be calculated using the following explicit formula:[2]

\left\{\begin{matrix} n \\ k \end{matrix}\right\} = \frac{1}{k!}\sum_{j=0}^{k}(-1)^j{k \choose j} (k-j)^n.

Notation

Various notations have been used for Stirling numbers of the second kind. The brace notation \textstyle \lbrace{n\atop k}\rbrace was used by Imanuel Marx and Antonio Salmeri in 1962 for variants of these numbers.[3][4] This led Knuth to use it, as shown here, in the first volume of The Art of Computer Programming (1968).[5][6] However, according to the third edition of The Art of Computer Programming, this notation was also used earlier by Jovan Karamata in 1935.[7][8] The notation S(n,k) was used by Richard Stanley in his book Enumerative Combinatorics.[5]

Bell numbers

The sum over the values for k of the Stirling numbers of the second kind, gives us

B_n=\sum_{k=0}^n \left\{\begin{matrix} n \\ k \end{matrix}\right\}

the nth Bell number, that is the total number of partitions of a set with n members.

If we let

(x)_n=x(x-1)(x-2)\cdots(x-n%2B1)

(in particular, (x)0 = 1 because it is an empty product) be the falling factorial,[9] we can characterize the Stirling numbers of the second kind by

\sum_{k=0}^n \left\{\begin{matrix} n \\ k \end{matrix}\right\}(x)_k=x^n.

Table of values

Below is a triangular array of values for the Stirling numbers of the second kind (sequence A008277 in OEIS):

n \ k 0 1 2 3 4 5 6 7 8 9 10
0 1
1 0 1
2 0 1 1
3 0 1 3 1
4 0 1 7 6 1
5 0 1 15 25 10 1
6 0 1 31 90 65 15 1
7 0 1 63 301 350 140 21 1
8 0 1 127 966 1701 1050 266 28 1
9 0 1 255 3025 7770 6951 2646 462 36 1
10 0 1 511 9330 34105 42525 22827 5880 750 45 1

As with the binomial coefficients, this table could be extended to k > n, but those entries would all be 0.

Properties

Recurrence relation

Stirling numbers of the second kind obey the recurrence relation

\left\{{n%2B1\atop k}\right\} = k \left\{{ n \atop k }\right\} %2B \left\{{n\atop k-1}\right\}

for k > 0 with initial conditions

\left\{{ 0 \atop 0 }\right\} = 1
\quad \mbox{ and } \quad
\left\{{ n \atop 0 }\right\} = \left\{{ 0 \atop n }\right\} = 0

for n > 0.

For instance, the number 25 in column k=3 and row n=5 is given by 25=7+(3×6), where 7 is the number above and to the left of 25, 6 is the number above 25 and 3 is the column containing the 6.

To understand this recurrence, observe that a partition of the n+1 objects into k nonempty subsets either contains the subset \{n%2B1\} or it does not. The number of ways that \{n%2B1\} is one of the subsets is given by

\left\{{ n \atop k-1 }\right\}

since we must partition the remaining n objects into the available k-1 subsets. The number of ways that \{n%2B1\} is not one of the subsets (that is, n+1 belongs to a subset containing other elements) is given by

k \left\{{ n \atop k }\right\}

since we partition all elements other than n+1 into k subsets, and then are left with k choices for inserting the element n+1. Summing these two values gives the desired result.

Parity

The parity of a Stirling number of the second kind is equal to the parity of a related binomial coefficient:


\left\{\begin{matrix}n\\k\end{matrix}\right\}\equiv\begin{pmatrix}z\\w\end{pmatrix}\ \pmod{2},\quad
z = n - \left\lceil\displaystyle\frac{k %2B 1}{2}\right\rceil,\ w = \left\lfloor\displaystyle\frac{k - 1}{2}\right\rfloor.

This relation is specified by mapping n and k coordinates onto the Sierpiński triangle.

Or directly, let two sets contain positions of 1's in binary representations of results of respective expressions:


\begin{align}
\mathbb{A}:\ \sum_{i\in\mathbb{A}} 2^i &= n-k,\\
\mathbb{B}:\ \sum_{j\in\mathbb{B}} 2^j &= \left\lfloor\dfrac{k - 1}{2}\right\rfloor,\\
\end{align}

then mimic a bitwise AND operation by intersecting these two sets:


\begin{Bmatrix}n\\k\end{Bmatrix}\,\bmod\,2 =
\begin{cases}
 0, & \mathbb{A}\cap\mathbb{B}\ne\empty\\
 1, & \mathbb{A}\cap\mathbb{B}=\empty
\end{cases}

to obtain the parity of a Stirling number of the second kind in O(1) time. In pseudocode:


\begin{Bmatrix}n\\k\end{Bmatrix}\,\bmod\,2�:= \left(n-k\right)\!\!\And\!\!\left( \left(k-1\right)\,\mathrm{div}\,2 \right) == 0.

Simple identities

Some simple identities include

\left\{\begin{matrix} n \\ n-1 \end{matrix}\right\} =
{n \choose 2}.

This is because dividing n elements into n − 1 sets necessarily means dividing it into one set of size 2 and n − 2 sets of size 1. Therefore we need only pick those two elements;

and

\left\{\begin{matrix} n \\ 2 \end{matrix}\right\} = 2^{n-1}-1.

To see this, first note that there are 2 n ordered pairs of complementary subsets A and B. In one case, A is empty, and in another B is empty, so 2 n − 2 ordered pairs of subsets remain. Finally, since we want unordered pairs rather than ordered pairs we divide this last number by 2, giving the result above.

Another explicit expanding of the recurrence-relation gives identities in the spirit of the above example.

\left\{\begin{matrix} n \\ 2 \end{matrix}\right\} = \frac{ \frac11 (2^{n-1}-1^{n-1}) }{0!}
\left\{\begin{matrix} n \\ 3 \end{matrix}\right\} = \frac{ \frac11 (3^{n-1}-2^{n-1})- \frac12 (3^{n-1}-1^{n-1}) }{1!}
\left\{\begin{matrix} n \\ 4 \end{matrix}\right\} = \frac{ \frac11 (4^{n-1}-3^{n-1})- \frac22 (4^{n-1}-2^{n-1}) %2B  \frac13 (4^{n-1}-1^{n-1})}{2!}
\left\{\begin{matrix} n \\ 5 \end{matrix}\right\} = \frac{ \frac11 (5^{n-1}-4^{n-1})- \frac32 (5^{n-1}-3^{n-1}) %2B \frac33 (5^{n-1}-2^{n-1}) -  \frac14 (5^{n-1}-1^{n-1}) }{3!}
\vdots

Explicit formula

The Stirling numbers of the second kind are given by the explicit formula:

\left\{\begin{matrix} n \\ k \end{matrix}\right\}
=\sum_{j=1}^k (-1)^{k-j} \frac{j^{n-1}}{(j-1)!(k-j)!}
=\frac{1}{k!}\sum_{j=0}^{k}(-1)^{k-j}{k \choose j} j^n
.

This formula is a special case of the k 'th forward difference of the monomial x^n evaluated at x = 0:

 \Delta^k x^n = \sum_{j=0}^{k}(-1)^{k-j}{k \choose j} (x%2Bj)^n.

Because the Bernoulli polynomials may be written in terms of these forward differences, one immediately obtains a relation in the Bernoulli numbers:

B_m(0)=\sum_{k=0}^m \frac {(-1)^k k!}{k%2B1}
\left\{\begin{matrix} m \\ k \end{matrix}\right\}.

Generating function

A generating function for the Stirling numbers of the second kind is given by

 \sum_{k=0}^n
\left\{\begin{matrix} n \\ k \end{matrix}\right\}
(x)_k = x^n.

Applications

Moments of the Poisson distribution

If X is a random variable with a Poisson distribution with expected value λ, then its nth moment is

E(X^n)=\sum_{k=1}^n \left\{\begin{matrix} n \\ k \end{matrix}\right\}\lambda^k.

In particular, the nth moment of the Poisson distribution with expected value 1 is precisely the number of partitions of a set of size n, i.e., it is the nth Bell number (this fact is Dobinski's formula).

Moments of fixed points of random permutations

Let the random variable X be the number of fixed points of a uniformly distributed random permutation of a finite set of size m. Then the nth moment of X is

E(X^n) = \sum_{k=1}^m \left\{\begin{matrix} n \\ k \end{matrix}\right\}.

Note: The upper bound of summation is m, not n.

In other words, the nth moment of this probability distribution is the number of partitions of a set of size n into no more than m parts. This is proved on the page on random permutation statistics, although the notation is a bit different.

Rhyming schemes

The Stirling numbers of the second kind can represent the total number of rhyme schemes for a poem of n lines. S(n,k) gives the number of possible rhyming schemes for n lines using k unique rhyming syllables. As an example, for a poem of 3 lines, there is 1 rhyme scheme using just one rhyme (aaa), 3 rhyme schemes using two rhymes (aab, aba, abb), and 1 rhyme scheme using three rhymes (abc).

Reduced Stirling numbers of the second kind

Denote the n objects to partition by the integers 1, 2, ..., n. Define the reduced Stirling numbers of the second kind, denoted S^d(n, k), to be the number of ways to partition the integers 1, 2, ..., n into k nonempty subsets such that all elements in each subset have pairwise distance at least d. That is, for any integers i and j in a given subset, it is required that |i-j| \geq d. It has been shown that these numbers satisfy

S^d(n, k) = S(n-d%2B1, k-d%2B1), n \geq k \geq d

(hence the name "reduced").[10] Observe (both by definition and by the reduction formula), that S^1(n, k) = S(n, k), the familiar Stirling numbers of the second kind.

See also

References

  1. ^ Ronald L. Graham, Donald E. Knuth, Oren Patashnik (1988) Concrete Mathematics, Addison-Wesley, Reading MA. ISBN 0-201-14236-8, p. 244.
  2. ^ Sharp, Henry (1968), "Cardinality of finite topologies", J. Combinatorial Theory 5: 82–86, doi:10.1016/S0021-9800(68)80031-6, MR0226578 
  3. ^ Transformation of Series by a Variant of Stirling's Numbers, Imanuel Marx, The American Mathematical Monthly 69, #6 (June-July 1962), pp. 530-532, JSTOR 2311194.
  4. ^ Antonio Salmeri, Introduzione alla teoria dei coefficienti fattoriali, Giornale di Matematiche di Battaglini 90 (1962), pp. 44-54.
  5. ^ a b p. 410-412, Two Notes on Notation, Donald E. Knuth, The American Mathematical Monthly 99, #5 (May 1992), pp. 403-422, JSTOR 2325085.
  6. ^ Donald E. Knuth, Fundamental Algorithms, Reading, Mass.: Addison-Wesley, 1968.
  7. ^ p. 66, Donald E. Knuth, Fundamental Algorithms, 3rd ed., Reading, Mass.: Addison-Wesley, 1997.
  8. ^ Jovan Karamata, Théorèmes sur la sommabilité exponentielle et d'autres sommabilités s'y rattachant, Mathematica (Cluj) 9 (1935), pp, 164-178.
  9. ^ Confusingly, the notation that combinatorialists use for falling factorials coincides with the notation used in special functions for rising factorials; see Pochhammer symbol.
  10. ^ A. Mohr and T.D. Porter, Applications of Chromatic Polynomials Involving Stirling Numbers, Journal of Combinatorial Mathematics and Combinatorial Computing 70 (2009), 57 - 64.